/*
 * Utils.h
 *
 *  Created on: May 4, 2011
 *      Author: trungtq
 */

#ifndef CURRIFY_H_
#define CURRIFY_H_

#include <map>
#include <sstream>
#include <string>
#include <iostream>
#include "CCOption.h"
#include "CCException.h"
#include "Function.h"
#include "Term.h"
#include "Equation.h"

class Utils {
public:
    Utils();
    virtual ~Utils();

public:
    /* currify */
    static Function currifier;
    static Term currify(Term term);
    static Term uncurrify(Term term);
    static bool isCurrified(Term term);
    static Equation currify(Equation equation);
    static Equation uncurrify(Equation equation);
    static bool isCurrified(Equation equation);

    /* flatten */
    static Term flatten2003(Term currifiedTerm, TermMap* flattenMap, TermSet* flattenerSet);
    static Term flatten2007(Term currifiedTerm, TermMap* flattenMap, TermSet* flattenerSet);
    static Term unflatten(Term flattenedTerm, TermMap unflattenMap, TermSet flattenerSet);
    static bool isFlattened(Term term);
    static bool isFlattener(Term term);
    static Equation flatten(Equation currifiedEquation, TermMap* flattenMap, TermSet* flattenerSet);
    static Equation unflatten(Equation flattenedEquation, TermMap flattenMap, TermSet flattenerSet);
    static bool isFlattened(Equation equation);
    static string flattenerRoot;

    /* other function */
    static void printTermMap(TermMap termMap);
};

#endif /* CURRIFY_H_ */
